package com.meichis.yndms.adapter;

import android.content.Context;

import com.meichis.mcsappframework.adapter.recyclerview.CommonAdapter;
import com.meichis.mcsappframework.adapter.recyclerview.base.ViewHolder;
import com.meichis.yndms.R;
import com.meichis.yndms.model.BusinessBoard;

import java.util.ArrayList;

/**
 * @author xmy
 * @title
 * @remake
 * @create 2022-05-18 10:55
 */
public class ProductArrivalAdapter extends CommonAdapter<BusinessBoard> {

    public ProductArrivalAdapter(Context context, int layoutId) {
        super(context, layoutId, new ArrayList<>());
    }

    @Override
    protected void convert(ViewHolder holder, BusinessBoard businessBoard, int position) {
        holder.setText(R.id.tv_brand, businessBoard.getSbuBrand());
        holder.setText(R.id.tv_quantity, businessBoard.getQuantity());

        if (position % 2 == 0) {
            if (position == mDatas.size() - 1) {
                holder.setBackgroundRes(R.id.ll_item, R.drawable.shape_fillet_bottom_solid_white);
            } else {
                holder.setBackgroundRes(R.id.ll_item, R.color.white);
            }
        } else {
            if (position == mDatas.size() - 1) {
                holder.setBackgroundRes(R.id.ll_item, R.drawable.shape_fillet_bottom_solid_theme_light);
            } else {
                holder.setBackgroundRes(R.id.ll_item, R.color.theme_light);
            }
        }
    }
}
